$(function(){
    $.ajax({
        url: 'http://139.9.177.51:3333/p2p/getBorrowList',
        type: 'get',
        data: {
            pageIndex: 1,
            pageSize: 4
        },
        dataType: 'json',
        success: function (res) {
            //console.log(res);
            //console.log(res.data);
            let leng = res.data.length;
            let data = res.data;
            let trS = '';
            for (let i = 0; i < leng; i++) {
                data[i].repaytype = data[i].repaytype == 0 ? data[i].repaytype = '按月分期' : data[i].repaytype = '按月到期'
                //console.log(data[i]);
                trS += `
            <tr>
                <td>${data[i].username}</td>
                <td>${data[i].title}</td>
                <td>${data[i].interest}%</td>
                <td>${data[i].borrowmoney}</td>
                <td>${data[i].repaytype}</td>
                <td>${data[i].ownmoney}</td>
                <td><button id="btn" data-id="${data[i].id}">查看</button></td>
             </tr>
                `
            }
            $('#list').html(trS)
        }
    })
})